package bfgca;
import java.awt.*;
import javax.swing.*;

public class SystemDetailComponent extends JPanel{

  private static final int COMP_SIZE_X = 150;
  private static final int COMP_SIZE_Y = 150;
  
  private PlanetTableModel ptm = new PlanetTableModel();
  private VesselTableModel vtm = new VesselTableModel();
  private ActivityTableModel atm = new ActivityTableModel();
  
  JTable planetTable = new JTable(ptm);
  JTable vesselTable = new JTable(vtm);
  JTable activityTable = new JTable(atm);
  
  JScrollPane pScroll = new JScrollPane(planetTable);
  JScrollPane vScroll = new JScrollPane(vesselTable);
  JScrollPane aScroll = new JScrollPane(activityTable);
  
  //TODO show actual intel level
  JLabel sysTitle = new JLabel("System Title: Intel Level Unknown", 
      JLabel.CENTER);
  JLabel pLabel = new JLabel("Planets");
  JLabel vLabel = new JLabel("Vessels");
  JLabel aLabel = new JLabel("Activity");

  public SystemDetailComponent(){
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints titleCons = new GridBagConstraints();
    GridBagConstraints tableCons = new GridBagConstraints();
    GridBagConstraints labelCons = new GridBagConstraints();
    titleCons.fill = titleCons.HORIZONTAL;
    titleCons.gridwidth = titleCons.REMAINDER;
    titleCons.weighty = 0;
    titleCons.weightx = 1;
    tableCons.fill = tableCons.BOTH;
    tableCons.gridwidth = tableCons.REMAINDER;
    tableCons.weighty = 1;
    tableCons.weightx = 1;
    labelCons.fill = tableCons.HORIZONTAL;
//    labelCons.gridwidth = labelCons.REMAINDER;
    labelCons.weighty = 0;
    labelCons.weightx = 0;

    this.setLayout(gridbag);
    gridbag.setConstraints(sysTitle, titleCons);
    this.add(sysTitle);
    gridbag.setConstraints(pLabel, labelCons);
    this.add(pLabel);
    gridbag.setConstraints(pScroll, tableCons);
    this.add(pScroll);
    gridbag.setConstraints(vLabel, labelCons);
    this.add(vLabel);
    gridbag.setConstraints(vScroll, tableCons);
    this.add(vScroll);
    gridbag.setConstraints(aLabel, labelCons);
    this.add(aLabel);
    gridbag.setConstraints(aScroll, tableCons);
    this.add(aScroll);
    this.setPreferredSize(new Dimension(COMP_SIZE_X, COMP_SIZE_Y));
  }

}
